package com.dhy.canal.autoconfigure;


import com.dhy.canal.CanalManager;
import com.dhy.canal.CanalMessageDispatcher;
import com.dhy.canal.CanalProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 大忽悠
 * @create 2022/12/27 10:42
 */
@Configuration
@EnableConfigurationProperties(CanalProperties.class)
public class CanalAutoConfiguration {

    @Bean
    public CanalMessageDispatcher canalMessageDispatcher(){
         return new CanalMessageDispatcher();
    }

    @Bean
    public CanalManager canalManager(CanalProperties canalProperties, CanalMessageDispatcher canalMessageDispatcher){
        return new CanalManager(canalProperties,canalMessageDispatcher);
    }
}
